<template>
  <div class="hello">
     <button @click="wxPay">点击</button>
  </div>
</template>

<script>

  import {getJsSdkConfigData} from '../api/index'
  import {wexinPay} from '../assets/js/weixin'
  import {interfaceAddress} from '../assets/js/config'
export default {
  name: 'HelloWorld',
  data () {
    return {
       dataConfig:""
    }
  },
  created(){
    // getJsSdkConfigData(this,interfaceAddress()['weixin-jssdk-config'])
    getJsSdkConfigData(this,"api/weixin/index/getJssdkConfig")
  },
  methods:{
    wxPay:function () {
      this.$router.push({
        path: `/complete/1111`
      });
        wexinPay(this.dataConfig,function (res) {
           // alert(JSON.stringify(res))
        },function (err) {
          // alert(JSON.stringify(err))
        })
    }
  }

}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
